package com.piper.long_connection.pb_server.handler;

import com.google.protobuf.InvalidProtocolBufferException;
import com.piper.long_connection.pb_model.core.model.Result;
import com.piper.long_connection.pb_model.core.model.ResultCode;
import com.piper.long_connection.pb_model.order_module.OrderModule;


public class OrderHandlerImpl implements OrderHandler {

    @Override
    public Result<?> publicChat(byte[] data) {
        try {
            OrderModule.Order order = OrderModule.Order.parseFrom(data);
            System.out.println(order.toString());
        } catch (InvalidProtocolBufferException e) {
            return Result.ERROR(ResultCode.UNKOWN_EXCEPTION);
        }
        return Result.SUCCESS();
    }

}
